package cn.kickegg.techx.mq.consumer;


import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author chenkai
 * @createTime 2024/6/7 14:31
 * @description
 * @keyPoint
 */
@Slf4j
@Component
@RocketMQMessageListener(
        topic = "rocket-topic-2",
        consumerGroup = "rocket-topic-2-consumer-group"
)
public class RocketmqConsumer implements RocketMQListener<MessageExt> {

    @Override
    public void onMessage(MessageExt messageExt) {
        // 处理接收到的消息
        log.info("[onMessage][线程编号:{} 消息内容：{}]", Thread.currentThread().getId(), messageExt);
    }
}
